﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Application.aspx.cs" ViewStateMode="Enabled" EnableViewState="true" Inherits="JX.Enrollment.Web.Application" %>

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">

    <script src="Scripts/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript">

        // DEBUG CODE
        //function debug(message) {
        //    $("#result").append(message + "<br/>");
        //}

        $(document).ready(function () {
            //openDatePicker();
            fadeOut('#MainContent_lblNotification');

            var backOnTop = $('a#MainContent_lnkBacktotop');
            if (backOnTop.is(':visible')) { backOnTop.hide(); }
        });

        function openDatePicker() {
            $(function () {
                $('#birthDate').datetimepicker({
                    format: 'MM/DD/YYYY'
                });
            });
        }
        $(window).scroll(function () {
            if ($(this).scrollTop() > 200) {
                $('a#MainContent_lnkBacktotop').fadeIn();
            } else {
                $('a#MainContent_lnkBacktotop').fadeOut();
            }
        });

        function fadeOut(id) {
            if ($(id).is(':visible')) {
                $(id).fadeOut(4000, function () {
                    $(this).val(''); //reset the label after fadeout
                });
            }
        }

        function onMouseUp(id) {
            $(id).mouseup(function () {
                var notification = $('#MainContent_lblNotification');
                var resetLink = $('a#MainContent_lnkReset');
                var noRecord = $('#MainContent_lblNoFound');

                if (notification.is(':visible')) { notification.hide(); }
                if (resetLink.is(':visible')) { resetLink.text("Reset List"); }
                if (noRecord.is(':visible')) { noRecord.hide(); }

                $(id).val("");
            });

            $(id).mouseleave(function () {
                var val = $(this).val()

                if (val == "") {
                    $(this).val("Search here...");
                }
            });

            $(id).keydown(function () {
                String(id).replace("Search here...", "");
            });

            $(id).keypress(function (e) {
                var code = e.keyCode || e.which;
                if (code == 13) {
                    javascript: __doPostBack('ctl00$MainContent$lnkSearch', '');

                    var notification = $('#MainContent_lblNotification');
                    var resetLink = $('a#MainContent_lnkReset');
                    var noRecord = $('#MainContent_lblNoFound');

                    if (noRecord.is(':visible')) {
                        if (resetLink.is(':visible')) { resetLink.text("Reset List"); }
                        if (notification.is(':visible')) { notification.hide(); }
                    }
                    return false;
                }
            });
        }

        function redirect(uri) {
            location.href = uri;
        }


    </script>
    <style type="text/css">
        .form-group.required .control-label:after
        {
            color: #d00;
            content: "*";
            position: absolute;
            margin-left: 8px;
            top: 7px;
        }
    </style>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <asp:Panel ID="Pnldisplay" runat="server" ViewStateMode="Enabled" EnableViewState="true">
        <asp:UpdatePanel runat="server" ID="UpdatePanel" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel ID="PnlWorkList" runat="server">
                    <table style="width: 100%">
                        <tr style="height: 5px;">
                            <asp:Label ID="lblNote" runat="server" Text="Application is for New and Transferee Students." Visible="true"></asp:Label>
                        </tr>
                        <tr>
                            <td style="width: 30%;">
                                <asp:Label ID="lblNoFound" runat="server" CssClass="notfound" Text="No Records Available." Visible="false"></asp:Label>
                            </td>
                            <td style="width: auto; text-align: center">
                                <asp:Label ID="lblNotification" runat="server" CssClass="mainmessage-notification" Visible="false"></asp:Label>
                                <asp:LinkButton ID="lnkReset" runat="server" Text="Reset List" OnClick="lnkReset_Click" Visible="false" ForeColor="Green" Font-Size="large"></asp:LinkButton>
                            </td>
                            <td style="width: 30%; text-align: right;">
                                <asp:TextBox ID="txtSearch" runat="server" Text="Search here..." Width="150px"></asp:TextBox>
                                <asp:LinkButton ID="lnkSearch" runat="server" Text="Search" OnClick="lnkSearch_Click"></asp:LinkButton>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 30%;">
                                <asp:LinkButton ID="lnkAddNew" runat="server" OnClick="lnkAddNew_Click"></asp:LinkButton>
                            </td>
                            <td></td>
                            <td style="width: 30%; text-align: right;">
                                <asp:LinkButton ID="lnkDeleteSelect" runat="server" Text="Delete Selected" OnClick="lnkDeleteSelect_Click" Visible="false"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                    <asp:GridView ID="grid" runat="server" Width="100%" AllowSorting="True" ShowHeaderWhenEmpty="true" AutoGenerateColumns="False" CssClass="gridrow" DataKeyNames="ID" OnRowCommand="grid_RowCommand" OnSorting="grid_Sorting" OnRowDataBound="grid_RowDataBound" PageSize="20" AutoGenerateSelectButton="True" ShowFooter="True">
                        <AlternatingRowStyle BackColor="AliceBlue" />
                        <Columns>
                            <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" Visible="false" />
                            <asp:BoundField DataField="TempNo" HeaderText="Reference #" SortExpression="TempNo" />
                            <asp:BoundField DataField="LastName" HeaderText="Last Name" SortExpression="LastName" />
                            <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                            <asp:BoundField DataField="MiddleName" HeaderText="Middle Name" SortExpression="MiddleName" />
                            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
                            <asp:BoundField DataField="PreviousSchool" HeaderText="Previous School" SortExpression="PreviousSchool" />
                            <asp:BoundField DataField="CreatedDate" HeaderText="Date Created" SortExpression="CreatedDate" />
                            <asp:TemplateField HeaderText="Action">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chkSelect" runat="server" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' OnCheckedChanged="chkSelect_CheckedChanged" AutoPostBack="true"></asp:CheckBox>
                                    <asp:LinkButton ID="lnkEdit" runat="server" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' CommandName="EditRec" Text="Edit" data-target="#myModal" UseSubmitBehavior="false"
                                        data-dismiss="modal"></asp:LinkButton>
                                    <asp:LinkButton ID="lnkDelete" runat="server" CommandArgument='<%# DataBinder.Eval(Container, "RowIndex") %>' CommandName="DeleteRec" Text="Delete"></asp:LinkButton>
                                </ItemTemplate>
                                <ItemStyle Wrap="False" />
                            </asp:TemplateField>
                        </Columns>
                        <HeaderStyle BackColor="#F4F4F4" />
                        <SelectedRowStyle BackColor="#ACD6FF" Font-Bold="true" ForeColor="DarkBlue" />
                    </asp:GridView>
                    <table style="width: 100%">
                        <tr>
                            <td style="width: 30%;">
                                <asp:LinkButton ID="lnkAdd" runat="server" OnClick="lnkAddNew_Click"></asp:LinkButton>
                            </td>
                            <td style="text-align: center;">
                                <asp:LinkButton ID="lnkBacktotop" runat="server" Text="Back to Top" OnClientClick="redirect('#')"></asp:LinkButton>
                            </td>
                            <td style="width: 30%; text-align: right;">
                                <asp:LinkButton ID="lnkDeleteSelected" runat="server" Text="Delete Selected" OnClick="lnkDeleteSelect_Click" Visible="false"></asp:LinkButton>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Panel>
    <div style="clear: both"></div>
    <asp:UpdatePanel runat="server" ID="ModalDialog">
        <ContentTemplate>
            <asp:Panel ID="PnlModal" runat="server">
                <div class="container">
                    <!-- Modal -->
                    <div class="modal fade" id="myModal" role="dialog" runat="server">
                        <div class="modal-dialog" style="width: 900px;">
                            <!-- Modal content-->
                            <div class="modal-content" style="height: 90%;">
                                <div class="modal-header">
                                    <h4 class="modal-title" style="color:blue">
                                        <asp:Label ID="lblModalheader" runat="server" />
                                    </h4>
                                </div>
                                <div class="modal-body" style="padding-top: 5px;">
                                    <ul class="nav nav-tabs" id="tabContent">
                                        <li class="active"><a href="#personal" data-toggle="tab">Personal Data   </a></li>
                                        <li><a href="#parents" data-toggle="tab">Parents</a></li>
                                        <li><a href="#school" data-toggle="tab">School</a></li>
                                    </ul>

                                    <div class="tab-content">
                                        <div class="tab-pane active" id="personal">
                                            <table style="width: 50%">
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblTempNo" runat="server" Text="Reference No."></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtTempNo" runat="server" CssClass="form-control" MaxLength="50" Enabled="false"></asp:TextBox>
                                                        </td>
                                                        <td>
                                                            <asp:DropDownList ID="ddlSY" runat="server" CssClass="form-control">
                                                                <asp:ListItem Text="SY2015" Value="2015"> </asp:ListItem>
                                                                <asp:ListItem Text="SY2016" Value="2016"> </asp:ListItem>
                                                            </asp:DropDownList>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblLRN" runat="server" Text="LRN"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtLRN" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblType" runat="server" Text="Type"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:DropDownList ID="ddlType" runat="server" CssClass="form-control">
                                                                <asp:ListItem Text="New Student" Value="New Student"> </asp:ListItem>
                                                                <asp:ListItem Text="Transferee" Value="Transferee"> </asp:ListItem>
                                                            </asp:DropDownList>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblLastName" runat="server" Text="Last Name"></asp:Label></td>
                                                        <td class="Placeholder" />
                                                        <td colspan="2">
                                                            <asp:TextBox ID="txtLastName" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblFirstName" runat="server" Text="First Name"></asp:Label></td>
                                                        <td class="Placeholder" />
                                                        <td colspan="2">
                                                            <asp:TextBox ID="txtFirstName" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox></td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblMiddleName" runat="server" Text="Middle Name"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtMiddleName" runat="server" CssClass="form-control" MaxLength="50"></asp:TextBox></td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblLevel" runat="server" Text="Level"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:DropDownList ID="DropDownList1" runat="server" CssClass="form-control">
                                                                <asp:ListItem Text="Kindergarten" Value="K"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 1" Value="G1"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 2" Value="G2"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 3" Value="G3"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 4" Value="G4"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 5" Value="G5"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 6" Value="G6"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 7" Value="G7"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 8" Value="G8"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 9" Value="G9"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 10" Value="G10"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 11" Value="G11"> </asp:ListItem>
                                                                <asp:ListItem Text="Grade 12" Value="G12"> </asp:ListItem>
                                                            </asp:DropDownList>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblBdate" runat="server" Text="Birth Date"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <div class="input-group date" id="birthDate">
                                                                <asp:TextBox ID="txtBdate" runat="server" CssClass="form-control" data-format="mm/dd/yyyy" placeholder="mm/dd/yyyy" />
                                                                <span class="input-group-addon btn" onclick="openDatePicker()">
                                                                    <span class="glyphicon glyphicon-calendar"></span>
                                                                </span>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>

                                        <div class="tab-pane" id="parents">
                                            <table style="width: 100%">
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblFather" runat="server" Text="Father's Full Name"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtFather" runat="server" CssClass="form-control" MaxLength="50" placeholder="Name"></asp:TextBox></td>
                                                        <td class="Placeholder" />
                                                        <td>
                                                            <asp:TextBox ID="txtFatherContact" runat="server" CssClass="form-control" MaxLength="50" placeholder="Contact Number"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblMother" runat="server" Text="Mother's Full Name"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtMother" runat="server" CssClass="form-control" MaxLength="50" placeholder="Name"></asp:TextBox></td>
                                                        <td class="Placeholder" />
                                                        <td>
                                                            <asp:TextBox ID="txtMotherContact" runat="server" CssClass="form-control" MaxLength="50" placeholder="Contact Number"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <th>
                                                            <asp:Label ID="lblNotParent" runat="server" Text="(If not parent)" CssClass="form-control-static" />
                                                        </th>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblGuardian" runat="server" Text="Guardian's Full Name"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtGuardian" runat="server" CssClass="form-control" MaxLength="50"
                                                                placeholder="Name"></asp:TextBox></td>
                                                        <td class="Placeholder" />
                                                        <td>
                                                            <asp:TextBox ID="txtGuardianContact" runat="server" CssClass="form-control" MaxLength="50" placeholder="Contact Number"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td></td>
                                                        <td class="Placeholder" />
                                                        <td colspan="3">
                                                            <asp:TextBox ID="txtRelationship" runat="server" CssClass="form-control" MaxLength="50" placeholder="Relationship"></asp:TextBox>
                                                        </td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="Label1" runat="server" Text="Address"></asp:Label></td>
                                                        <td class="Placeholder" />
                                                        <td colspan="3">
                                                            <asp:TextBox ID="TextBox1" runat="server" CssClass="form-control" MaxLength="150" TextMode="MultiLine"></asp:TextBox></td>
                                                    </tr>
                                                </tbody>
                                            </table>

                                        </div>
                                        <div class="tab-pane" id="school">
                                            <table style="width: 100%">
                                                <tbody>
                                                    <tr>
                                                        <td>
                                                            <asp:Label ID="lblPreviousSchool" runat="server" Text="Previous School"></asp:Label></td>
                                                        <td class="Placeholder"></td>
                                                        <td>
                                                            <asp:TextBox ID="txtPreviousSchool" runat="server" CssClass="form-control" MaxLength="150" TextMode="MultiLine"></asp:TextBox></td>
                                                    </tr>
                                                    <tr class="Placeholder"></tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="modal-footer" style="padding-top: 7px;">
                                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" class="btn btn-default" data-dismiss="modal" UseSubmitBehavior="false" OnClick="btnSubmit_Click" />
                                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" class="btn btn-default" data-dismiss="modal" UseSubmitBehavior="false" OnClick="btnCancel_Click" />
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </asp:Panel>
        </ContentTemplate>
    </asp:UpdatePanel>


</asp:Content>
